//
//  VRCaipiaoClassCell.m
//  VRKaiCai
//
//  Created by slh on 2017/6/23.
//  Copyright © 2017年 slh. All rights reserved.
//

#import "VRCaipiaoClassCell.h"

#import "VRCaipiaoClass.h"


@interface VRCaipiaoClassCell()

@property (nonatomic, weak) UILabel *detailLbl;

@end

@implementation VRCaipiaoClassCell

- (void)setModel:(VRCaipiaoClass *)model
{
    _model = model;
    
    self.detailLbl.text = model.name;
}

+ (instancetype)cellWith:(UITableView *)tableview
{
    static NSString *cellID = @"VRCaipiaoClassCell";
    
    VRCaipiaoClassCell *cell = [tableview dequeueReusableCellWithIdentifier:cellID];
    
    if (nil == cell) {
        cell = [[VRCaipiaoClassCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
    }
    
    return cell;
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        self.textLabel.mj_x = 30;
        self.textLabel.font = [UIFont systemFontOfSize:15];
        self.textLabel.textColor = VRColor(146, 146, 146);
        
        self.imageView.image = [UIImage imageNamed:@"caipiao"];
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        
        UILabel *detailLbl = [[UILabel alloc] init];
        detailLbl.text = @"天津德贝尔口腔诊所";
        //        detailLbl.textColor = YAYIColor(146, 146, 146);
        detailLbl.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:detailLbl];
        self.detailLbl = detailLbl;
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.textLabel.mj_x = 20;
    
    self.imageView.size = CGSizeMake(40, 40);
    self.imageView.centerY = self.contentView.centerY;
    
    [self.detailLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(-30);
        make.right.equalTo(self);
        make.height.equalTo(@30);
        make.centerY.equalTo(self);
        
    }];
}

@end
